<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8"/>
		<title>Struct ControlBlock</title>
		<link rel="stylesheet" type="text/css" href="../../styles/ddox.css"/>
		<link rel="stylesheet" href="../../prettify/prettify.css" type="text/css"/>
		<script type="text/javascript" src="../../scripts/jquery.js">/**/</script><script type="text/javascript" src="../../scripts/ddox.js">/**/</script>
	</head>
	<body onload="setupDdox();">
		<nav id="main-nav">
			<noscript>
				<p style="color: red">The search functionality needs JavaScript enabled</p>
			</noscript>
			<div id="symbolSearchPane" style="display: none">
				<form action="#" method="GET">
					<input id="symbolSearch" type="text" name="q" placeholder="Search for symbols" autocomplete="off" onchange="performSymbolSearch(40);" onkeypress="this.onchange();" onpaste="this.onchange();" oninput="this.onchange();"/>
				</form>
				<ul id="symbolSearchResults" class="symbolList" style="display: none"></ul><script type="application/javascript" src="../../symbols.js"></script><script type="application/javascript">var symbolSearchRootDir = "../../";
$('#symbolSearchPane').show();</script>
			</div>
			<ul class="tree-view">
				<li class="tree-view ">
					<div class="package ">autoptr
					</div>
			<ul class="tree-view">
				<li>
					<div class="module selected">
						<a href="../../autoptr/common.html">common</a>
					</div>
				</li>
				<li>
					<div class="module ">
						<a href="../../autoptr/intrusive_ptr.html">intrusive_ptr</a>
					</div>
				</li>
				<li>
					<div class="module ">
						<a href="../../autoptr/rc_ptr.html">rc_ptr</a>
					</div>
				</li>
				<li>
					<div class="module ">
						<a href="../../autoptr/shared_ptr.html">shared_ptr</a>
					</div>
				</li>
				<li>
					<div class="module ">
						<a href="../../autoptr/unique_ptr.html">unique_ptr</a>
					</div>
				</li>
			</ul>
				</li>
			</ul>
		</nav>
		<div id="main-contents">
			<h1>Struct ControlBlock</h1><p>Control block for <code class="lang-d"><span class="typ">SharedPtr</span></code>, <code class="lang-d"><span class="typ">RcPtr</span></code>, <code class="lang-d"><span class="typ">UniquePtr</span></code> and <code class="lang-d"><span class="typ">IntrusivePtr</span></code>.
</p>
			<div class="prototype">
				<code class="lang-d">
					<div class="single-prototype">
			<span class="kwd">struct</span> <span class="typ">ControlBlock</span>(_Shared, _Weak)
			<span class="pun">;</span>
					</div>
				</code>
			</div>
			<section><p>Contains ref counting and dynamic dispatching for destruction and dealocation of managed object.
</p>

<p>    Template parameters:
</p>

<p>        <code class="lang-d"><span class="pln">_Shared</span></code> signed integer for ref counting of <code class="lang-d"><span class="typ">SharedPtr</span></code> or void if ref counting is not necessary (<code class="lang-d"><span class="typ">UniquePtr</span></code> doesn't need ref counting).
</p>

<p>        <code class="lang-d"><span class="pln">_Weak</span></code> signed integer for weak ref counting of <code class="lang-d"><span class="typ">SharedPtr</span></code> or void if weak pointer is not necessary.
</p>
</section>

			<section><h2>Constructors</h2>
				<table>
					<col class="caption"/>
					<tr>
						<th>Name</th><th>Description</th>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/common/ControlBlock.this.html" class="public">
								<code>this</code>
							</a>
							<span class="tableEntryAnnotation">()</span>
						</td>
						<td>Copy constructor is @disabled.
</td>
					</tr>
				</table>
			</section>
			<section><h2>Methods</h2>
				<table>
					<col class="caption"/>
					<tr>
						<th>Name</th><th>Description</th>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/common/ControlBlock.opAssign.html" class="public">
								<code>opAssign</code>
							</a>
							<span class="tableEntryAnnotation">()</span>
						</td>
						<td>Assign is @disabled.
</td>
					</tr>
				</table>
			</section>
			<section><h2>Aliases</h2>
				<table>
					<col class="caption"/>
					<tr>
						<th>Name</th><th>Description</th>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/common/ControlBlock.Shared.html" class="public">
								<code>Shared</code>
							</a>
						</td>
						<td>Signed integer for ref counting of <code class="lang-d"><span class="typ">SharedPtr</span></code> or void if ref counting is not necessary (<code class="lang-d"><span class="typ">UniquePtr</span></code>).
</td>
					</tr>
					<tr>
						<td>
							<a href="../../autoptr/common/ControlBlock.Weak.html" class="public">
								<code>Weak</code>
							</a>
						</td>
						<td>Signed integer for weak ref counting of <code class="lang-d"><span class="typ">SharedPtr</span></code> or void if weak counting is not necessary (<code class="lang-d"><span class="typ">UniquePtr</span></code> or <code class="lang-d"><span class="typ">SharedPtr</span></code> without weak ptr).
</td>
					</tr>
				</table>
			</section>
			<section><h2>Example</h2>

<pre class="code"><code class="lang-d"><span class="kwd">static assert</span><span class="pun">(</span><span class="kwd">is</span><span class="pun">(</span><span class="typ">ControlBlock</span><span class="pun">!(</span><span class="typ">int</span><span class="pun">, </span><span class="typ">long</span><span class="pun">)<wbr/>.</span><span class="typ">Shared </span><span class="pun">== </span><span class="typ">int</span><span class="pun">));
</span><span class="kwd">static assert</span><span class="pun">(</span><span class="kwd">is</span><span class="pun">(</span><span class="typ">ControlBlock</span><span class="pun">!(</span><span class="typ">int</span><span class="pun">, </span><span class="typ">long</span><span class="pun">)<wbr/>.</span><span class="typ">Weak </span><span class="pun">== </span><span class="typ">long</span><span class="pun">));
</span><span class="kwd">static assert</span><span class="pun">(</span><span class="kwd">is</span><span class="pun">(</span><span class="typ">ControlBlock</span><span class="pun">!</span><span class="typ">int<wbr/></span><span class="pun">.</span><span class="typ">Shared </span><span class="pun">== </span><span class="typ">int</span><span class="pun">));
</span><span class="kwd">static assert</span><span class="pun">(</span><span class="kwd">is</span><span class="pun">(</span><span class="typ">ControlBlock</span><span class="pun">!</span><span class="typ">int<wbr/></span><span class="pun">.</span><span class="typ">Weak </span><span class="pun">== </span><span class="typ">void</span><span class="pun">));

</span><span class="kwd">static assert</span><span class="pun">(</span><span class="typ">ControlBlock</span><span class="pun">!(</span><span class="typ">int</span><span class="pun">, </span><span class="typ">int</span><span class="pun">)<wbr/>.</span><span class="pln">hasSharedCounter</span><span class="pun">);
</span><span class="kwd">static assert</span><span class="pun">(</span><span class="typ">ControlBlock</span><span class="pun">!(</span><span class="typ">int</span><span class="pun">, </span><span class="typ">int</span><span class="pun">)<wbr/>.</span><span class="pln">hasWeakCounter</span><span class="pun">);

</span><span class="kwd">static assert</span><span class="pun">(</span><span class="kwd">is</span><span class="pun">(</span><span class="typ">ControlBlock</span><span class="pun">!</span><span class="typ">int </span><span class="pun">== </span><span class="typ">ControlBlock</span><span class="pun">!(</span><span class="typ">int</span><span class="pun">, </span><span class="typ">void</span><span class="pun">)));  
</span><span class="kwd">static assert</span><span class="pun">(</span><span class="typ">ControlBlock</span><span class="pun">!</span><span class="typ">int<wbr/></span><span class="pun">.</span><span class="pln">hasSharedCounter</span><span class="pun">);   
</span><span class="kwd">static assert</span><span class="pun">(</span><span class="typ">ControlBlock</span><span class="pun">!</span><span class="typ">int<wbr/></span><span class="pun">.</span><span class="pln">hasWeakCounter </span><span class="pun">== </span><span class="kwd">false</span><span class="pun">);

</span><span class="kwd">static assert</span><span class="pun">(</span><span class="typ">ControlBlock</span><span class="pun">!</span><span class="typ">void<wbr/></span><span class="pun">.</span><span class="pln">hasSharedCounter </span><span class="pun">== </span><span class="kwd">false</span><span class="pun">);
</span><span class="kwd">static assert</span><span class="pun">(</span><span class="typ">ControlBlock</span><span class="pun">!</span><span class="typ">void<wbr/></span><span class="pun">.</span><span class="pln">hasWeakCounter </span><span class="pun">== </span><span class="kwd">false</span><span class="pun">);
}



</span><span class="com">/+
/**
Check if type `T` is of type `MutableControlBlock!(...)`.
*/
public template isMutableControlBlock(T...)
if(T.length == 1){
import std.traits : Unqual;

enum bool isMutableControlBlock = is(
    Unqual!(T[0]) == MutableControlBlock!Args, Args...
);
}


import std.traits : isIntegral;

/**
Mutable intrusive `ControlBlock`, this control block can be modified even if is `const` / `immutable`.

Necessary for `IntrusivePtr`.

Examples are in `IntrusiveControlBlock`.
*/
template MutableControlBlock(_Shared, _Weak = void)
if(isIntegral!_Shared){
import std.traits : Unqual, isUnsigned, isIntegral, isMutable;

static assert(isIntegral!_Shared &amp;&amp; !isUnsigned!_Shared || is(_Weak == void));
static assert(is(Unqual!_Shared == _Shared));

static assert((isIntegral!_Weak &amp;&amp; !isUnsigned!_Weak) || is(_Weak == void));
static assert(is(Unqual!_Weak == _Weak));

alias MutableControlBlock = MutableControlBlock!(ControlBlock!(_Shared, _Weak));
}

/// ditto
template MutableControlBlock(_ControlType)
if(isControlBlock!_ControlType){
import std.traits : isMutable;

static assert(isMutable!_ControlType);

struct MutableControlBlock{
    public alias ControlType = _ControlType;

    private ControlType control;
}
</span></code></pre>
</section>

			<footer>
				<table class="license-info">
					<tr>
						<th>Authors</th>
						<td>
							<p>github.com/submada/basic_string, Adam Búš
</p>

						</td>
					</tr>
					<tr>
						<th>Copyright</th>
						<td>
							
						</td>
					</tr>
					<tr>
						<th>License</th>
						<td>
							<p>www.boost.org/LICENSE_1_0.txt, Boost License 1.0.
</p>

						</td>
					</tr>
				</table>
				<p class="faint">Generated using the DDOX documentation generator</p>
			</footer>
		</div>
	</body>
</html>